import { VxeFormItemProps, VxeGridPropTypes } from '@/components/VxeTable';
import { BasicColumn, FormSchema } from '@/components/Table';
import { categoryList } from '@/api/heng/ex';


/**
 */
export const vxeTableColumns: VxeGridPropTypes.Columns = [
  {
    type:'checkbox',
    title: '',
    field: 'seq',
    width: 40,
  },
  {
    title: '题目内容',
    field: 'title',
    showOverflow: 'title',
    // filters: [{ data: '' }],
    // filterRender: {
    //   name: 'VxeInput',
    // },
  },
  {
    title: '图片',
    field: 'img',
    showOverflow: 'title',
    align: 'center',
    width: 80,
    slots: {
      default:"img_slot"
    }
  },
  {
    title: '类型',
    field: 'type',
    showOverflow: 'title',
    align: 'center',
    width: 140,
  },
  {
    title: '分类',
    field: 'categoryName',
    showOverflow: 'title',
    align: 'center',
    width: 140,
  },
  {
    title: '上级分类',
    field: 'pcategoryName',
    showOverflow: 'title',
    align: 'center',
    width: 140,
  },
  {
    title: '解析',
    field: 'explain',
    align: 'center',
  },
  {
    title: '创建时间',
    field: 'createTime',
    width: 180,
    align: 'center',
  },
  {
    width: 180,
    title: '操作',
    align: 'center',
    field: '',
    slots: { default: 'action' },
    fixed: 'right',
  },
];

export const vxeTableFormSchema: VxeFormItemProps[] = [
  {
    span: 5,
    field: 'keyword',
    title: '查询',
    itemRender: {
      props: {
        placeholder: '查询',
      },
      name: 'AInput',
    },
  },
  {
    span: 5,
    field: 'categoryId',
    title: '分类',
    itemRender: {
      props: {
        style:{width:'100%'},
        api:categoryList,
        resultField:'data',
        labelField:'categoryName',
        valueField:'categoryId'
      },
      name: 'AApiTreeSelect',
    },
    visible:true
  },
  {
    span: 5,
    field: 'type',
    title: '题目类型',
    itemRender: {
      props: {
        placeholder: '请选择',
        style:{width:'100%'},
        options: [
          { label: '单选题', value: '单选题' },
          { label: '多选题', value: '多选题' },
        ],
      },
      name: 'ASelect',
    },
  },
  {
    span: 5,
    itemRender: {
      name: 'VxeButtonGroup',
      options: [
        { type: 'reset', content: '重置' },
        { type: 'submit', content: '查询', status: 'primary' },
      ],
    },
  },
];
